package sparkCore.util

import org.apache.spark.{SparkConf, SparkContext}

import scala.collection.immutable.HashMap

object CommonTools {

  def getSparkContext(appName:String,master:String="local[*]",other:HashMap[String,Any]=null):SparkContext = {
    val conf = new SparkConf().setMaster(master).setAppName(appName)
    if(other!=null){
      other.foreach(kv=>{
        conf.set(kv._1,kv._2+"")
      })
    }
    new SparkContext(conf)
  }

}
